/*
package cn.school.mybatis.filter;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Enumeration;

@WebFilter("/*")
public class SessionFilter implements Filter {
    public void destroy() {
    }

    public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws ServletException, IOException {
        HttpServletRequest request = (HttpServletRequest) req;
        HttpSession session = request.getSession();
        //获取session中所有的键值
        Enumeration enumeration = session.getAttributeNames();
        //遍历enumeration中的
        while (enumeration.hasMoreElements()) {
             //获取session键值
            String name1 = enumeration.nextElement().toString();
             //根据键值取session中的值
            Object value = request.getSession().getAttribute(name1);
            //打印结果
            System.err.println(name1 + "= " + value.toString() + "/n");
            resp.setContentType("text/html;charset=UTF-8");
            PrintWriter out = resp.getWriter();
            out.println("<B>" + name1 + "</B> = " + value.toString() + "<br>/n");
            chain.doFilter(req, resp);
        }
    }

    public void init(FilterConfig config) throws ServletException {

    }

}
*/
